import requests

url = "https://testpassport.rabbitpre.com/api/sso/login"
data = {
    "account": "xxx",
    "password": "xxx",
    "fromType": "pc"
}
session = requests.session()
# 去除warning
requests.packages.urllib3.disable_warnings()

response = session.post(url, json=data, verify=False)
print(response.text)

if response.json().get("errorCode") == "SUCCESS":
    print("登录成功")
else:
    print("登录失败")


# user请求接口
User_Request_URL = "https://bws.test.rabbitpre.com/api/user"
requests.packages.urllib3.disable_warnings()

# 获得user接口返回的数据信息
r_user = session.get(User_Request_URL, verify=False)

# orgid请求接口
orgID_Request_URL = "https://home.test.rabbitpre.com/api/workbench/org/getCompanyInfo?"
requests.packages.urllib3.disable_warnings()

r_orgID = session.get(orgID_Request_URL, verify=False)

# 取出两个接口中的user信息和orgID信息

getUserid = r_user.json()["data"]["userId"]
getorgID = r_orgID.json()["data"]["org_id"]

print('企业的userID =', getUserid)
print('企业的orgID  =', getorgID)




